import { createSSRApp } from "vue";
import * as Pinia from 'pinia';
import { createI18n } from "vue-i18n";
import App from "./App.vue";
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import messages from './locale/index'

let i18nConfig = {
	locale: uni.getLocale(),
	fallbackLocale: 'en',
	messages
}

// import * as QQMapWX from '@/common/utils/qqmap-wx-jssdk.js';
export function createApp() {
	const app = createSSRApp(App);
	const pinia = Pinia.createPinia();
	const i18nInstance = createI18n(i18nConfig)
	// 实例化API核心类
	// app.config.globalProperties.qqmapsdk = new QQMapWX.default({
	// 	key: '4PEBZ-65JK6-FOZSR-ETR6G-SKSPQ-RUFVP'
	// });
	pinia.use(piniaPluginPersistedstate);
	app.use(pinia);
	app.use(i18nInstance)
	return {
		app,
		pinia
	};
}